﻿using Ducu.BLL.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Ducu.SRV.Query
{
    public static class OnHistoryItem
    {
        public static IQueryable<HistoryItem> Get(this IQueryable<HistoryItem> source, 
            User executor)
        {
            return source.Where(h => h.Executor == executor);
        }

        public static IQueryable<HistoryItem> Get(this IQueryable<HistoryItem> source, 
            User executor, DateTime date)
        {
            DateTime from = date.Date;
            return source.Get(executor)
                .Where(h => h.CreateTime > from && h.CreateTime < from.AddDays(1));
        }
    }
}
